<?php 


//TODO put param in the separate (encrypted?) file
define("HOST","localhost");
define("PORT", "5432");
define("DBNAME", "videoclub");
define("DBUSER", "postgres");
define("PASSWORD", "admin");


function connectToDB(){
    $db = new PDO("pgsql:host=" . HOST . ";port= " . PORT . ";dbname=" . DBNAME,
                    DBUSER, PASSWORD)
          or die("Echec de connexion au serveur");
    $db->exec("SET NAMES 'UTF8'");
    return $db;
}


function execQuery($sql){
    $db = connectToDB();
    $rq=$db->prepare($sql);
    $rq->execute();
    return $rq;
}

?>
